package com.wing.sell.controller.app;

import com.wing.common.utils.PageResult;
import com.wing.platform.feign.PlatformClient;
import com.wing.platform.order.model.entity.HelpCenterCategory;
import com.wing.web.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author
 */
@Validated
@Api(value = "Admin-帮助中心分类管理", tags = "#/sell/helpCenterCategory")
@RestController("helpCenterCategoryController")
@RequestMapping("sell/admin/helpCenterCategory")
@RequiredArgsConstructor
public class HelpCenterCategoryController {

    private final PlatformClient platformClient;


    @ApiOperation(value = "查询所有帮助中心分类", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", defaultValue = "1", example = "1", dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "limit", value = "每页多少条", defaultValue = "10", example = "10", dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "sort", value="排序字段名", defaultValue = "sort_number", example = "sort_number", dataType = "Integer", paramType = "query")
            ,@ApiImplicitParam(name = "order", value="排序规则(asc:正序, desc:倒序)", defaultValue = "asc", example = "asc", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "name", value = "名称", defaultValue = "", example = "", dataType = "String", paramType = "query")
    })
    @GetMapping("/list")
    public PageResult<HelpCenterCategory> list(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,@RequestParam(defaultValue = "sort_number") String sort
            ,@RequestParam(defaultValue = "asc") String order
            ,String name
            ,String enterpriseCode
            ,Long parentId
    ){
        return platformClient.helpCenterCategoryList(page, limit, sort, order, name, JwtUtils.getChannelCode(), parentId);
    }




}
